<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html; charset=utf-8"%>

<nav class="navbar navbar-inverse navbar-fixed-top">
	<div class="container">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
				<span class="sr-only">Toggle navigation</span> 
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span>
			</button>
		</div>
		<div id="navbar" class="collapse navbar-collapse">
			<ul class="nav navbar-nav">
				<li ${param.module eq "index" ? "class='active'" : "" }>
					<a href="${pageContext.request.contextPath }/home/index">首页</a>
				</li>
				<li ${param.module eq "admin" ? "class='active'" : ""}>
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true">管理员 <span class="caret"></span></a>
					<ul class="dropdown-menu">
						<li><a href="${pageContext.request.contextPath }/admin/toPowerList">权限列表</a></li>
						<li><a href="${pageContext.request.contextPath }/admin/toRoleList">角色列表</a></li>
						<li><a href="${pageContext.request.contextPath }/admin/toUserList">用戶列表</a></li>
					</ul>
				</li>
				<li ${param.module eq "other" ? "active" : ""}>
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true">更多 <span class="caret"></span></a>
					<ul class="dropdown-menu">
						<li><a href="${pageContext.request.contextPath}/game/list">游戏</a></li>
					</ul>
				</li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<c:choose>
					<c:when test="${empty sessionScope.USER}">
						<!-- <li><a data-toggle="modal" data-target="#dialog">登录</a></li> -->
						<li><a href="${pageContext.request.contextPath }/user/toLogin">登录</a></li>
						<li><a href="${pageContext.request.contextPath }/user/toRegister">注册</a></li>
					</c:when>
					<c:otherwise>
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"> ${sessionScope.USER.userName} <span class="caret"></span></a>
							<ul class="dropdown-menu">
								<li>
									<a href="${pageContext.request.contextPath }/admin/admin/${sessionScope.ADMINSTRATOR_ID}">用户信息</a>
								</li>
								<li>
									<a href="${pageContext.request.contextPath}/admin/change_password">修改密码</a>
								</li>
							</ul>
						</li>
						<li><a href="${pageContext.request.contextPath}/user/logout">退出</a></li>
					</c:otherwise>
				</c:choose>
			</ul>
		</div>
	</div>
</nav>

<div class="modal fade" id="dialog" tabindex="-1" role="dialog"
	aria-labelledby="dialogLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-body">
				<div>
					<ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="#login"
							aria-controls="home" role="tab" data-toggle="tab">登录</a></li>
						<li role="presentation"><a href="#register"
							aria-controls="profile" role="tab" data-toggle="tab">注册</a></li>
					</ul>
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane active" id="login">
							<form method="post"
								action="${pageContext.request.contextPath}/user/login">
								<div class="form-group">
									<label for="loginUserName">用户名</label> <input type="text"
										class="form-control" id="loginUserName" name="userName"
										placeholder="用户名、邮箱">
								</div>
								<div class="form-group">
									<label for="loginUserPassword">密码</label> <input
										type="password" class="form-control" id="loginUserPassword"
										name="userPassword" placeholder="密码">
								</div>
								<button type="submit" class="btn btn-default">登录</button>
							</form>
						</div>
						<div role="tabpanel" class="tab-pane" id="register">
							<form method="post"
								action="${pageContext.request.contextPath}/user/register">
								<div class="form-group">
									<label for="loginUserName">用户名</label> <input type="text"
										class="form-control" id="loginUserName" name="userName"
										placeholder="用户名、邮箱">
								</div>
								<div class="form-group">
									<label for="loginUserPassword">密码</label> <input
										type="password" class="form-control" id="loginUserPassword"
										name="userPassword" placeholder="密码">
								</div>
								<button type="submit" class="btn btn-default">注册</button>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
